package com.bite.book;

//Slf4j接口
interface Slf4jApi{
    void log(String message);
}

//log4j接口
class Log4j{
    void log4jLog(String message){
        System.out.println("Log4j打印:" + message);
    }
}

//slf4j和log4j适配器

class Slf4jLog4JAdapter implements Slf4jApi{

    private Log4j log4j;

    public Slf4jLog4JAdapter(Log4j log4j) {
        this.log4j = log4j;
    }

    @Override
    public void log(String message) {
        log4j.log4jLog(message);
    }
}
public class Slf4jDemo {
    public static void main(String[] args) {
        Slf4jApi slf4jApi = new Slf4jLog4JAdapter(new Log4j());
        slf4jApi.log("使用slf4j打印日志");
    }
}
